import java.util.ArrayList;
import java.util.List;

// 学生类
class Student {
    private String name;
    private List<Subject> subjects;

    public Student(String name) {
        this.name = name;
        this.subjects = new ArrayList<>();
    }

    public void addSubject(Subject subject) {
        subjects.add(subject);
        subject.addStudent(this);
    }

    public String getName() {
        return name;
    }

    public List<Subject> getSubjects() {
        return subjects;
    }
}

// 课程类
class Subject {
    private String name;
    private Department department;
    private List<Student> students;

    public Subject(String name, Department department) {
        this.name = name;
        this.department = department;
        this.students = new ArrayList<>();
    }

    public void addStudent(Student student) {
        students.add(student);
    }

    public String getName() {
        return name;
    }

    public Department getDepartment() {
        return department;
    }

    public List<Student> getStudents() {
        return students;
    }
}

// 教师类
class Instructor {
    private String name;
    private Department department;
    private List<Subject> subjects;

    public Instructor(String name, Department department) {
        this.name = name;
        this.department = department;
        this.subjects = new ArrayList<>();
    }

    public void addSubject(Subject subject) {
        subjects.add(subject);
    }

    public String getName() {
        return name;
    }

    public Department getDepartment() {
        return department;
    }

    public List<Subject> getSubjects() {
        return subjects;
    }
}

// 系类
class Department {
    private String name;
    private List<Instructor> instructors;
    private List<Subject> subjects;

    public Department(String name) {
        this.name = name;
        this.instructors = new ArrayList<>();
        this.subjects = new ArrayList<>();
    }

    public void addInstructor(Instructor instructor) {
        instructors.add(instructor);
    }

    public void addSubject(Subject subject) {
        subjects.add(subject);
    }

    public String getName() {
        return name;
    }

    public List<Instructor> getInstructors() {
        return instructors;
    }

    public List<Subject> getSubjects() {
        return subjects;
    }
}

// 学院类
class School {
    private List<Department> departments;

    public School() {
        this.departments = new ArrayList<>();
    }

    public void addDepartment(Department department) {
        departments.add(department);
    }

    public List<Department> getDepartments() {
        return departments;
    }
}